#include <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

const double MIN = 999999.0;

struct Pos{
	double x;
	double y;
};

double GetDis(Pos p1, Pos p2)
{
	return sqrt((p1.x - p2.x)*(p1.x - p2.x) + (p1.y - p2.y)*(p1.y - p2.y));
}


int main()
{
	int t;
	cin >> t;
	Pos pos[1000];
	
	while(t--)
	{
		double min = MIN;
		int n;
		cin >> n;
		for(int i = 0; i < n; i++)
		{
			cin >> pos[i].x >> pos[i].y;
		}
		for(int i = 0; i < n; i++)
		{
			for(int j = i+1; j < n; j++)
			{
				if(GetDis(pos[i], pos[j]) < min)
				{
					min = GetDis(pos[i], pos[j]);
				}
			}
		}
		printf("%.4lf\n", min);
	} 
	return 0;
}














